<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="jquery.min.js"></script>
    <style>
        div {
            position: absolute;
            width: 100px;
            height: 100px;
            background-color: pink;
        }
    </style>
</head>

<body>
    <div></div>
    <script>
        function fn(i, fun) { //这就是高阶函数
            console.log(i);
            fun && fun();
        };
        fn(1, function fun() {
            console.log('我是回调函数');
        });

        //让div移动600px 后改变颜色就运用到高阶函数 就是一个函数里边回调一个函数
        // 用到jQuery
        $("div").animate({
            left: 500
        }, function() {
            $("div").css("background", "blue");
        });
    </script>
</body>

</html>